package net.xdclass.feign;

import io.swagger.annotations.ApiParam;
import net.xdclass.request.LockCouponRecordRequest;
import net.xdclass.utils.JsonData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "xdclass-coupon-service")
public interface CouponFeignService {

    /**
     * 查询用户的优惠券是否可用,防止水平越权
     * @param recordId
     * @return
     */
    @GetMapping("api/coupon-record/v1/detail/{record_id}")
    JsonData getCouponRecordDetail(@PathVariable("record_id")long recordId);

    /**
     * 锁定优惠券
     * @param recordRequest
     * @return
     */
    @PostMapping("/api/coupon-record/v1/lock_records")
    JsonData lockCouponRecords(@ApiParam("锁定优惠券请求对象") @RequestBody LockCouponRecordRequest recordRequest);
}
